#pragma once
/*!
 * \file 
 * UtilTime.h
 */

/*!
 * \brief class relate with "time"
 *
 * class related with "time"
 *
 *	This class is similar to CTime class but has less functionality
 *
 * - header file: UtilTime.h
 * - lib: util.lib
 * - DLL: util.dll
 */
class AFX_EXT_CLASS CUtilTime
{
private:
	TCHAR	m_buff[128];

public:
	/*!
	 * constructor 
	 */
	CUtilTime(void);
	/**
	 * destructor
	 */
	~CUtilTime(void);

	/*!
	 * returns time_t value which is truncated by date
	 * @param tTime time
	 * @return returns truncated time by date
	 */
	time_t GetDate(time_t tTime);
	time_t GetDateNext(time_t tTime);
	time_t GetNextMinute(time_t tTime);
	/*!
	 * makes time_t type value from the data of year, month, day, hour, minute and second
	 * @param nYear year, the minimum value of nYear is 1970
	 * @param nMonth month, January is 1, that means nMonth value starts from 1
	 * @param nDay day, nDay value starts from 1
	 * @param nHour hour, ranges from 0 to 23
	 * @param nMinute minute, ranges from 0 to 59
	 * @param nSecond second, ranges form 0 to 59
	 *
	 * @return time_t type value from parameters
	 */
	time_t MakeTime(int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);

	int GetYear(time_t tTime);		/**< get year from tTime  	*/
	int GetMonth(time_t tTime);		/**< get month from tTime */
	int GetDay(time_t tTime);		/**< get day from tTime */
	int GetHour(time_t tTime);		/**< get hour from tTime */
	int GetMinute(time_t tTime);	/**< get minute from tTime */
	int GetSecond(time_t tTime);	/**< get second from tTime */

	void GetDateTimeString(time_t tTime, TCHAR* tzStr);		/**< get date and time string from tTime */
	void GetEndMinuteTimeString(time_t tTime, TCHAR* tzStr);
	void GetDateString(time_t tTime, TCHAR *tzStr);			/**< get date string from tTime */
	void GetTimeString(time_t tTime, TCHAR *tzStr);			/**< get time string from tTime */	
	void GetTimeString2(time_t tTime, TCHAR *tzStr);		/**< get time string form tTime with the format of pm/am */
	void GetHourString(time_t tTime, TCHAR *tzStr);			/**< get hour string from tTime with */


};
